<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <link rel="stylesheet" href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css" />
    <link rel="stylesheet" type="text/css" href="https://a.amap.com/jsapi_demos/static/demo-center/css/prety-json.css">
    <style>
        html,
        body,
        #container {
            width: 100%;
            height: 100%;
        }
    </style>
    <title>获取地图当前行政区</title>
</head>

<body>
<div id="container"></div>
<div class="info">
    <h4>当前所在行政区信息</h4>
    <p><span id="map-city"></span></p>
</div>
<script src="https://webapi.amap.com/maps?v=2.0&key=c29ba8687c42813e047ac08da5a29f11"></script>
<script type="text/javascript" src="https://a.amap.com/jsapi_demos/static/demo-center/js/jquery-1.11.1.min.js" ></script>
<script type="text/javascript" src="https://a.amap.com/jsapi_demos/static/demo-center/js/underscore-min.js" ></script>
<script type="text/javascript" src="https://a.amap.com/jsapi_demos/static/demo-center/js/backbone-min.js" ></script>
<script type="text/javascript" src='https://a.amap.com/jsapi_demos/static/demo-center/js/prety-json.js'></script>
<script>
    //初始化地图
    var map = new AMap.Map('container', {
        resizeEnable: true, //是否监控地图容器尺寸变化
        zoom: 11, //初始地图级别
    });

    //获取并展示当前城市信息
    function logMapinfo(){
        map.getCity( function(info){
            var node = new PrettyJSON.view.Node({
                el: document.querySelector("#map-city"),
                data: info
            });
        });
    }

    logMapinfo();

    //绑定地图移动事件
    map.on('moveend', logMapinfo);
</script>
</body>

</html>